20260729 Coverity fixes - #11006
Open
rlm2002 wants to merge 3 commits into
Open
Conversation
|
Frauschi
requested changes
Jul 31, 2026
Frauschi
left a comment
Contributor
There was a problem hiding this comment.
🐺 Skoll Code Review
Overall recommendation: REQUEST_CHANGES
Findings: 12 total — 4 posted, 8 skipped
Posted findings
- [High] globalRNGMutex leaked when wc_RNG_GenerateBlock() fails in AddSession() —
src/ssl_sess.c:2172-2185 - [Medium] initGlobalRNG is not re-checked after taking the lock (documented racy pattern elsewhere) —
src/ssl_sess.c:2167-2177 - [Medium] No test exercises the new oversized-DER rejection path —
src/pk_rsa.c:654-659 - [Low] test_coding.c change guards the read but does not initialize
encas the PR describes —tests/api/test_coding.c:328-347
Skipped findings
- [High] globalRNGMutex leaked on wc_RNG_GenerateBlock failure path in AddSession
- [High] globalRNGMutex left locked when wc_RNG_GenerateBlock() fails in AddSession()
- [Medium] DER size cap expression
(RSA_MAX_SIZE / 8) * 8reduces toRSA_MAX_SIZEand contradicts its comment - [Medium] AddSession() global-RNG locking path has no regression test
- [Medium] initGlobalRNG not re-checked after acquiring globalRNGMutex in AddSession (races wolfSSL_RAND_Cleanup)
- [Low] Misindented return block does not match wolfSSL brace/indent style
- [Info] DER cap expression
(RSA_MAX_SIZE / 8) * 8is a no-op and its comment contradicts the code - [Info] New error-return block in AddSession() uses non-conforming indentation
Review generated by Skoll via Claude/Codex
… defined prevent potential deadlock
Frauschi
requested changes
Aug 3, 2026
Frauschi
left a comment
Contributor
There was a problem hiding this comment.
🐺 Skoll Code Review
Overall recommendation: REQUEST_CHANGES
Findings: 7 total — 2 posted, 5 skipped
Posted findings
- [High] New test's preprocessor guard does not match the API it calls - link failure in OPENSSL_EXTRA-without-OPENSSL_ALL builds —
tests/api.c:20494-20520 - [High] Test installs a raw malloc callback while leaving the previous free/realloc callbacks in place - invalid free in --enable-trackmemory builds —
tests/api.c:20502-20551
Skipped findings
- [Medium] Bit-count constant RSA_MAX_SIZE compared against a byte length
- [Medium] Triple-duplicated unlock blocks and a garbled comment in AddSession
- [Medium] No test coverage for the new globalRNG locking path in AddSession
- [Low] enc[outLen - 1] still underflows if Base64_Encode returns outLen == 0
- [Low] Redundant #ifndef NO_BIO block in testCases[] and a free of an always-NULL pointer
Review generated by Skoll via Claude/Codex
Test oversized DER is rejected before allocation
philljj
requested changes
Aug 5, 2026
| rng = ssl->rng; | ||
| #if defined(HAVE_GLOBAL_RNG) && defined(OPENSSL_EXTRA) | ||
| else if (initGlobalRNG == 1 || wolfSSL_RAND_Init() == WOLFSSL_SUCCESS) { | ||
| else if (initGlobalRNG == 1 || |
Contributor
There was a problem hiding this comment.
I can't find a code path where ssl->rng would ever be null. Are we sure this isn't dead code?
We could also try to use a local rng first, and only fallback to the global RNG on error. We follow this pattern in src/pk.c and other places:
int initTmpRng = 0;
WC_RNG *rng = NULL;
WC_DECLARE_VAR(tmpRng, WC_RNG, 1, 0);
WC_ALLOC_VAR_EX(tmpRng, WC_RNG, 1, NULL, DYNAMIC_TYPE_RNG,
return WOLFSSL_FATAL_ERROR);
if (wc_InitRng(tmpRng) == 0) {
rng = tmpRng;
initTmpRng = 1;
}
else {
WOLFSSL_MSG("Bad RNG Init, trying global");
rng = wolfssl_get_global_rng();
}
Then we would only hit the global lock when the local temp rng init fails (which should be rare).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CID 561836: Untrusted value as argument - Bound untrusted DER length before allocation in
wolfssl_read_der_bioCID 561978: Uninitialized scalar variable - Initialize
encin test_coding.c to avoid use before set.CID 562025: Data race condition - Lock globalRNG in AddSession when falling back to the global RNG
Testing
./configure --enable-jni && make check